<template>
  <div class="demo-navigation">
    <a-card title="🎨 Iconify 图标示例导航" class="nav-card">
      <div class="nav-content">
        <p class="description">
          已成功安装 Iconify 图标库！现在您可以使用 <code>&lt;Icon icon="图标名称" /&gt;</code> 的方式来使用任何 Iconify 支持的图标。
        </p>
        
        <div class="nav-buttons">
          <a-space direction="vertical" size="large" style="width: 100%;">
            
            <a-card size="small" class="nav-item">
              <div class="nav-item-content">
                <div class="nav-item-info">
                  <h3>
                    <Icon icon="material-symbols:palette" style="margin-right: 8px;" />
                    图标对比展示
                  </h3>
                  <p>查看 Ant Design 图标与 Iconify 图标的对比效果</p>
                </div>
                <a-button type="primary" @click="goToDemo">
                  查看示例
                </a-button>
              </div>
            </a-card>

            <a-card size="small" class="nav-item">
              <div class="nav-item-content">
                <div class="nav-item-info">
                  <h3>
                    <Icon icon="material-symbols:smart-button" style="margin-right: 8px;" />
                    按钮图标替换
                  </h3>
                  <p>学习如何在按钮中使用 Iconify 图标替换原有图标</p>
                </div>
                <a-button type="primary" @click="goToButtons">
                  查看示例
                </a-button>
              </div>
            </a-card>

            <a-card size="small" class="nav-item">
              <div class="nav-item-content">
                <div class="nav-item-info">
                  <h3>
                    <Icon icon="material-symbols:web" style="margin-right: 8px;" />
                    Iconify 官网
                  </h3>
                  <p>浏览 Iconify 官网，查找更多精美图标</p>
                </div>
                <a-button @click="openIconifyWebsite">
                  访问官网
                </a-button>
              </div>
            </a-card>

          </a-space>
        </div>

        <div class="installation-info">
          <a-alert
            message="安装信息"
            type="success"
            show-icon
          >
            <template #description>
              <div>
                <p><strong>已安装的包：</strong></p>
                <ul>
                  <li><code>@iconify/vue</code> - Vue 3 的 Iconify 组件</li>
                  <li><code>@iconify/icons-material-symbols</code> - Material Symbols 图标集</li>
                </ul>
                <p><strong>使用方法：</strong></p>
                <p>在任何 Vue 组件中直接使用 <code>&lt;Icon icon="图标名称" /&gt;</code></p>
              </div>
            </template>
          </a-alert>
        </div>

        <div class="quick-examples">
          <h3>🚀 快速示例</h3>
          <div class="example-grid">
            <div class="example-item">
              <Icon icon="material-symbols:search" style="font-size: 24px; color: #1890ff;" />
              <code>material-symbols:search</code>
            </div>
            <div class="example-item">
              <Icon icon="material-symbols:person-add" style="font-size: 24px; color: #52c41a;" />
              <code>material-symbols:person-add</code>
            </div>
            <div class="example-item">
              <Icon icon="material-symbols:delete" style="font-size: 24px; color: #ff4d4f;" />
              <code>material-symbols:delete</code>
            </div>
            <div class="example-item">
              <Icon icon="material-symbols:settings" style="font-size: 24px; color: #faad14;" />
              <code>material-symbols:settings</code>
            </div>
          </div>
        </div>

      </div>
    </a-card>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

const goToDemo = () => {
  router.push('/iconify-demo')
}

const goToButtons = () => {
  router.push('/iconify-buttons')
}

const goToHome = () => {
  router.push('/')
}

const openIconifyWebsite = () => {
  window.open('https://icon-sets.iconify.design/', '_blank')
}
</script>

<style scoped>
.demo-navigation {
  padding: 20px;
  min-height: 100vh;
  background: #f5f5f5;
}

.nav-card {
  max-width: 800px;
  margin: 0 auto;
}

.description {
  font-size: 16px;
  color: #595959;
  margin-bottom: 24px;
  text-align: center;
}

.description code {
  background: #f6f8fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.nav-buttons {
  margin-bottom: 32px;
}

.nav-item {
  transition: all 0.3s ease;
}

.nav-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-item-info h3 {
  margin: 0 0 8px 0;
  color: #262626;
  display: flex;
  align-items: center;
}

.nav-item-info p {
  margin: 0;
  color: #8c8c8c;
  font-size: 14px;
}

.installation-info {
  margin-bottom: 32px;
}

.installation-info code {
  background: #f6f8fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.installation-info ul {
  margin: 8px 0;
  padding-left: 20px;
}

.quick-examples h3 {
  margin-bottom: 16px;
  color: #1890ff;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.example-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: white;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.example-item:hover {
  border-color: #1890ff;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.example-item code {
  margin-top: 8px;
  font-size: 12px;
  color: #8c8c8c;
  background: #f6f8fa;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

@media (max-width: 768px) {
  .nav-item-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .example-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}
</style>
